<%-- 
    Document   : userCreation
    Created on : 13 Oct, 2012, 10:50:15 AM
    Author     : Shwetha
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Create User</title>
        <link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
        <link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
        <link rel="stylesheet" href="css/style.css" type="text/css" media="all">
        
        <!-- Javascript -->
        <script>
            function validateForm()
            {
                var userNameError=document.forms["createUserForm"]["userName"].value;
                var emailIdError = document.forms["createUserForm"]["emailId"].value;
                var passwordError = document.forms["createUserForm"]["password"].value;
                
                if (userNameError==null || userNameError=="" || 
                    emailIdError ==null || emailIdError == "" || passwordError==null ||passwordError=="")
                {
                    alert("All the fields are required");
                    return false;
                 }else{
                      if(!validatePasswordMatch){
                        alert("Passwords don't match.")
                        return false;
                     }
                 }

                
            }
            
            function validatePasswordMatch()
            {
                var passwordError = document.forms["createUserForm"]["password"].value;
                var passwordReError = document.forms["createUserForm"]["rePassword"].value;
                
                if(passwordError != passwordReError){
                    return false;
                }
                
                return true;
            }
        </script>
    </head>
    
    <body onLoad="new ElementMaxHeight();">
    <div class="wrap">
    <!-- header -->
    <header>
        <div class="container">
            <h1><a href="index.jsp">Hope Center</a></h1>
            <nav>
                <ul>
                     <li ><a href="index.jsp"><strong>Home</strong></a></li>
                     <li class="current"><a href="userCreation.jsp"><strong>Create User</strong></a></li>
                </ul>
            </nav>
            <div id="slogan"></div>
        </div>
    </header>
    <!-- Page Content -->
    <form name="createUserForm" method="POST" onsubmit="return validateForm()" action="userCreationNav.jsp">
    <section id="content">
        <div class="container">
            <div class="inside">
                    <h2>User Creation</h2> 
		    <p>
                    <table width="700">
                        <tr>
                            <td style="padding: 5px">
                                <h3>Name </h3> 
                            </td>
                            <td style="padding: 5px">
                                <input type="text" name=userName>
                            </td>
                            <td style="padding: 5px">
                                
                                <font color="red"> </font>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding: 5px">
                                <h3>Password </h3> 
                            </td>
                            <td style="padding: 5px">
                                <input type="password" name="password">
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                        <tr>
                            <td style="padding: 5px">
                                <h3>Re-enter Password </h3> 
                            </td>
                            <td style="padding: 5px">
                                <input type="Password" name="rePassword">
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                        <tr>
                            <td style="padding: 5px">
                                <h3>Email Id </h3> 
                            </td>
                            <td style="padding: 5px">
                                <input type="text" name="emailId">
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                         <tr>
                            <td style="padding: 5px">
                                <h3>Role </h3> 
                            </td>
                            <td style="padding: 5px">
                                <select name="role" id="role">
                                    <option id="3" value="3">Doctor</option>
                                    <option id="2" value="2">Nurse</option>
                                    <option id="1" value="1">Others</option>
                                </select>
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                        <tr>
                            <td style="padding: 5px">    
                            </td>
                            <td style="padding: 5px">
                                <input type="submit" name="Create" >
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                                 <%
                                    String created = request.getParameter("created");
                                    if(created != null){
                                    boolean created_bol = Boolean.parseBoolean(request.getParameter("created")); 
                                       if(created_bol){
                                  %>
                                  <h4> User Created Successfully</h4>
                            </td>
                            <td style="color:red">
                                <%}else{ %>
                                  <h4> User not created!!</h4>
                                  <%} }%>
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                    </table>
            </div>
        </div>
    </section>
    </form>
    </div>
    <!-- footer -->
    <footer>
            <div class="container">
                    <div class="left">
                            <div class="right">
                                    <div class="inside">
    <a rel="nofollow" href="http://www.templatemonster.com/">Website template</a> designed by TemplateMonster.com<br/><a href="http://www.templates.com/product/illustrations/">Vector Illustrations</a> provided by Templates.com
                                    </div>
                            </div>
                    </div>
            </div>
    </footer>
    </body>
</html>
